package util;


import com.jme3.app.SimpleApplication;
import com.jme3.system.JmeCanvasContext;
import java.awt.Canvas;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author mathyas
 */
public class Monkey4Canvas {
    
    /*
     * Converte um objeto SimpleApplication do JMonkey
     * em um java.awt.Canvas, para poder ser usado em
     * componetes Swing e AWT.
     */
    public static Canvas parse(SimpleApplication app) {
        app.createCanvas();  //cria objeto canvas
        JmeCanvasContext ctx = (JmeCanvasContext) app.getContext();
        ctx.setSystemListener(app);
        //ctx.getCanvas().setPreferredSize(dim);
        
        return ctx.getCanvas();
    }
    
}
